import {} from "antd";
import { NavLink, Route, Switch } from "react-router-dom";
import {
  HomeOutlined,
  UserOutlined,
  FireOutlined,
  PlusOutlined,
} from "@ant-design/icons";
import Login from "./pages/Login";
import Reg from "./pages/Reg";
import Home from "./pages/Home";
import User from "./pages/User";
import Trends from "./pages/Trends";
import DD from "./pages/DD";
import  Provider from './components/user'
import { post } from "./utils/request";
import { getToken } from "./utils/tools";

function App() {
  return (
    <div className="App">
      <div className="main">
        <Switch>
          <Route path="/" exact>
            <Home />
          </Route>
          <Provider path="/user">
            <User />
          </Provider>
          <Route path="/dd">
            <DD />
          </Route>
          <Route path="/trends">
            <Trends />
          </Route>
          <Route path="/login">
            <Login />
          </Route>
          <Route path="/Reg">
            <Reg/>
          </Route>
        </Switch>
      </div>
      <div className="nav">
        <NavLink to="/" exact>
          <HomeOutlined />
          首页
        </NavLink>
        <NavLink to="/trends">
          <FireOutlined />
          动态
        </NavLink>
        <div className="bgc"></div>
        <div className="bgc-mark"></div>
        <button
          onClick={() => {
            post("/api/v1/posts", {
              forum: Date.now(),
              name: "帖子",
              desc: "简简单单的一个帖子",
              content: "就只是一个帖子",
              cover_image: "你猜是啥帖子",
            });
          }}
        >
          <PlusOutlined />
        </button>
        <div className="nav-mark"></div>
        <NavLink to="/dd">待定</NavLink>
        <NavLink to="/user">
          <UserOutlined />
          我的
        </NavLink>
      </div>
    </div>
  );
}

export default App;
